/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.game.main;

import com.game.clases.Hal9000;
import com.game.clases.Fosforo;
import com.game.clases.FosforoDireccion;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;

/**
 *
 * @author user
 */
public class MesaJuego extends JFrame{

    Fosforo fosforo;
    private Hal9000 hal9000;
    public static int turnoActual;
    /**
     * Creates new form MesaJuego
     */
    public MesaJuego() {
        initComponents();
        setLocationRelativeTo(null);
        hal9000 = new Hal9000();
        this.addMouseListener(hal9000);
        
        int x1 = 220, x2 = 320;
        int y1 = 20, y2 = 20;
        
        for (int i = 0; i < 22; i++) {
            
            if(i < 11){
                fosforo = new Fosforo(FosforoDireccion.RIGHT); 
                fosforo.setLocation(x1, y1);
                fosforo.addMouseListener(hal9000);
                jLayeredPane1.add(fosforo, JLayeredPane.PALETTE_LAYER);
                y1 += 30;
                
            }
            else{
                fosforo = new Fosforo(FosforoDireccion.LEFT);
                fosforo.setLocation(x2, y2);
                fosforo.addMouseListener(hal9000);
                jLayeredPane1.add(fosforo, JLayeredPane.PALETTE_LAYER);
                y2 += 30;
                System.out.println("Location " + x2 + " - " + y2);
            }
        }
        turnoActual = 0;
//        Random rand = new Random();
//        turnoActual = rand.nextInt(2);
//        
//        if (turnoActual == 0) {
//            System.out.println("Empieza el Humano");
//        }
//        else{
//            System.out.println("Empieza el PC");
//        }
    }

    /**
     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        test1 = new javax.swing.JLabel();
        test = new javax.swing.JLabel();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        lblFondoJugadior1 = new javax.swing.JLabel();
        lblFondoMesa = new javax.swing.JLabel();
        lblFondoJugador2 = new javax.swing.JLabel();
        lblFondoPuntos = new javax.swing.JLabel();
        lblJugador1 = new javax.swing.JLabel();
        lblJugador2 = new javax.swing.JLabel();

        test1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/fosforo_small_left.png"))); // NOI18N

        test.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/fosforo_small_right.png"))); // NOI18N

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Juego de Fosforos");
        setBackground(new java.awt.Color(0, 0, 0));

        lblFondoJugadior1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/area_jugador_1.png"))); // NOI18N
        lblFondoJugadior1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        lblFondoJugadior1.setBounds(0, 0, 110, 390);
        jLayeredPane1.add(lblFondoJugadior1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        lblFondoMesa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/pano_mesa_grande.jpg"))); // NOI18N
        lblFondoMesa.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        lblFondoMesa.setBounds(110, 0, 410, 390);
        jLayeredPane1.add(lblFondoMesa, javax.swing.JLayeredPane.DEFAULT_LAYER);

        lblFondoJugador2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/area_jugador_2.png"))); // NOI18N
        lblFondoJugador2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        lblFondoJugador2.setBounds(520, 0, 120, 390);
        jLayeredPane1.add(lblFondoJugador2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        lblFondoPuntos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/game/images/puntuacion.png"))); // NOI18N
        lblFondoPuntos.setBounds(0, 390, 640, 90);
        jLayeredPane1.add(lblFondoPuntos, javax.swing.JLayeredPane.DEFAULT_LAYER);

        lblJugador1.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
        lblJugador1.setForeground(new java.awt.Color(255, 255, 255));
        lblJugador1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblJugador1.setText("Jugador 1");
        lblJugador1.setBounds(10, 10, 90, 29);
        jLayeredPane1.add(lblJugador1, javax.swing.JLayeredPane.PALETTE_LAYER);

        lblJugador2.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
        lblJugador2.setForeground(new java.awt.Color(255, 255, 255));
        lblJugador2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblJugador2.setText("CPU");
        lblJugador2.setBounds(530, 10, 90, 29);
        jLayeredPane1.add(lblJugador2, javax.swing.JLayeredPane.PALETTE_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 640, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 480, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    
    /**
     * @param args the command line arguments
     */
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLabel lblFondoJugadior1;
    private javax.swing.JLabel lblFondoJugador2;
    private javax.swing.JLabel lblFondoMesa;
    private javax.swing.JLabel lblFondoPuntos;
    private javax.swing.JLabel lblJugador1;
    private javax.swing.JLabel lblJugador2;
    private javax.swing.JLabel test;
    private javax.swing.JLabel test1;
    // End of variables declaration//GEN-END:variables

    


}
